﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using OhioState.Graphics;
using OhioState.AssetManaged;
using OhioState.Graphics.Proxy;

namespace OhioState.Controls
{
    public partial class LayerConfigControl : UserControl
    {
        public LayerConfigControl()
            : this(null)
        {
        }

        public LayerConfigControl(ILayer layer)
        {
            InitializeComponent();
            cameraComboBox.Init(typeof(ICamera));
            fboComboBox.Init(typeof(IFrameBufferObject));
            SetLayer(layer);
        }

        public ICamera Camera
        {
            get
            {
                return cameraComboBox.GetSelected() as ICamera;
            }
        }

        public IFrameBufferObject FrameBuffer
        {
            get
            {
                return fboComboBox.GetSelected() as IFrameBufferObject;
            }
        }

        public void SetLayer(ILayer layer)
        {
            if (layer != null)
            {
                this.layer = layer;
                cameraComboBox.SelectItem(layer.Camera as IAssetManaged);
                fboComboBox.SelectItem(layer.FrameBuffer as IAssetManaged);
            }
        }

        private ILayer layer;
    }
}
